﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using PureMVC.Patterns;
using PureMVC.Interfaces;
using GameEngine.Clients.Silverlight.View;
using MySettlers.Screens;
using GameEngine.View;

namespace MySettlers.Commands
{
    public class Page_MainMenu_In_Command : SimpleCommand
    {
        override public void Execute(INotification notification)
        {
            Application app = notification.Body as Application;
            var mediator = MyViewFacade.Instance.CreateMenuMediator<string, MainMenu>(
                MyFacade.MainPageMediatorName, 
                new MainMenu(), 
                MyFacade.PAGE_MAIN_OUT_COMMAND);
            MyFacade.Instance.RegisterMediator(mediator);
            MyFacade.Instance.Start(app, true, mediator.ViewComponent);
        }
    }

    public class Page_MainMenu_Out_Command : SimpleCommand
    {
        override public void Execute(INotification notification)
        {
            MyFacade.Instance.RemoveMediator(MyFacade.MainPageMediatorName);
            switch (notification.Body as string) {
                case MainMenu.PLAYBUTTON:
                    MyFacade.Instance.SendNotification(MyFacade.PAGE_GAMEMAINMENU_IN_COMMAND);
                    break;
                case MainMenu.EDITORBUTTON:
                    MyFacade.Instance.SendNotification(MyFacade.PAGE_EDITORMAINMENU_IN_COMMAND);
                    break;
                case MainMenu.EXITBUTTON:
                    break;
             }
        }
    }
}
